using System;
using MonPocGarage.ArmyContracts.Common.Enums;

namespace MonPocGarage.ArmyContracts.Common.Abilities
{
    public class Reaction : IAbility
    {
        private AbilityColor m_AbilityColor;
        private readonly string m_AbilityID;
        private readonly ReactionType m_ReactionType;
        private readonly string m_AbilityName;
        private readonly string m_AbilityDescription;
        private readonly string m_ImagePath;

        public string AbilityID
        {
            get { return m_AbilityID; }
        }

        public AbilityType AbilityType
        {
            get { return AbilityType.Reaction; }
        }

        public AbilityColor AbilityColor
        {
            get { return m_AbilityColor; }
        }

        public string AbilityName
        {
            get { return m_AbilityName; }
        }

        public string AbilityDescription
        {
            get { return m_AbilityDescription; }
        }

        public ReactionType ReactionType
        {
            get { return m_ReactionType; }
        }

        public string ImagePath
        {
            get { return m_ImagePath; }
        }

        public void ChangeColor(AbilityColor newColor)
        {
            m_AbilityColor = newColor;
        }

        public Reaction(string abilityName, string abilityDescription, AbilityColor color, ReactionType reactionType)
        {
            m_AbilityColor = color;
            m_AbilityName = abilityName;
            m_AbilityDescription = abilityDescription;
            m_ReactionType = reactionType;
            m_ImagePath = BuildImagePath();
            m_AbilityID = m_AbilityName.Replace(" ", string.Empty);
        }

        public Reaction(Reaction another)
        {
            m_AbilityColor = another.AbilityColor;
            m_AbilityName = another.AbilityName;
            m_AbilityDescription = another.AbilityDescription;
            m_ReactionType = another.ReactionType;
            m_ImagePath = BuildImagePath();
            m_AbilityID = m_AbilityName.Replace(" ", string.Empty);
        }

        private string BuildImagePath()
        {
            string imagePath = "Images/Abilities/Actions/Reactions/" + m_AbilityName + "_";
            return imagePath;
        }

        public object Clone()
        {
            return new Reaction(this);
        }
    }
}